<div class="bjui-pageContent">
	<div><h4><?php echo Iif($admin->id, '编辑管理员', '添加管理员');?></h4></div>
    <form action="<?=admin_url('admin/save');?>" class="pageForm" data-toggle="validate" name="admin_edit" id="admin_edit">
        <input type="hidden" name="id" value="<?=$admin->id;?>">
        <table class="table table-condensed table-hover">
            <tbody>
                <tr>
                    <td>
                        <label class="control-label x85">用户名：</label>
                    </td>
                    <td width="100%">
						<input class="form-control" type="text" name="username" value="<?=$admin->username;?>" data-rule="required" size="16">
                    </td>
                </tr>

				<!-- 不允许改变: 超级管理员 或 自己的状态和角色 -->
				<?php if($admin->id != 1 AND $admin->id != $this->admin->id):?>
                <tr>
                    <td>
                        <label class="control-label x85">状态：</label>
                    </td>
                    <td width="100%">
						<input type="radio" name="status" value="1" id="status-1" data-toggle="icheck" data-label="正常" <?php if($admin->status == 1 OR empty($admin)):?> checked<?php endif;?>>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						<input type="radio" name="status" value="2" id="status-2" data-toggle="icheck" data-label="禁止" <?php if($admin->status == 2):?> checked<?php endif;?>>
						<span style="color:red;vertial-align:middle;">(注：禁止即无管理权限)</span>
                    </td>
                </tr>

                <tr>
                    <td>
                        <label class="control-label x85">角色：</label>
                    </td>
                    <td width="100%">
						<select name="role_id" data-toggle="selectpicker">
							<?php foreach($admin_roles as $role):?>
							<option value="<?=$role->id;?>" <?php if($admin->role_id == $role->id):?>selected<?php endif;?>><?=$role->role_name;?></option>
							<?php endforeach;?>
						</select>
                    </td>
                </tr>
				<?php endif;?>

				<?php if(empty($admin)):?>
                <tr>
                    <td>
                        <label class="control-label x85">密码：</label>
                    </td>
                    <td width="100%">
						<input class="form-control" name="password" value="" type="password" data-rule="密码:required" size="16">
					</td>
                </tr>

                <tr>
                    <td>
                        <label class="control-label x85">重复密码：</label>
                    </td>
                    <td width="100%">
						<input class="form-control" name="re_password" value="" type="password" data-rule="重复密码:required;match(password)" size="16">
					</td>
                </tr>
				<?php else:?>
                <tr>
                    <td>
                        <label class="control-label x85">密码：</label>
                    </td>
                    <td width="100%">
						<input class="form-control" name="password" value="" type="password" data-rule="" size="16">
						<span style="color:red;vertial-align:middle;">(注：不修改请留空)</span>
					</td>
                </tr>

                <tr>
                    <td>
                        <label class="control-label x85">重复密码：</label>
                    </td>
                    <td width="100%">
						<input class="form-control" name="re_password" value="" type="password" data-rule="" size="16">
					</td>
                </tr>
				<?php endif;?>

                <tr>
                    <td>&nbsp;</td>
                    <td width="100%">&nbsp;</td>
                </tr>

                <tr>
                    <td>
                        <label class="control-label x85">昵称：</label>
                    </td>
                    <td width="100%">
						<input class="form-control" type="text" name="nickname" value="<?=$admin->nickname;?>" data-rule="required" size="16">
					</td>
                </tr>

                <tr>
                    <td>
                        <label class="control-label x85">手机：</label>
                    </td>
                    <td width="100%">
						<input class="form-control" type="text" name="mobile" value="<?=$admin->mobile;?>" data-rule="mobile" size="16">
					</td>
                </tr>

                 <tr>
                    <td>
                        <label class="control-label x85">邮箱：</label>
                    </td>
                    <td width="100%">
						<input class="form-control" type="text" name="email" value="<?=$admin->email;?>" data-rule="email" size="26">
					</td>
                </tr>

            </tbody>
        </table>
    </form>
</div>
<div class="bjui-pageFooter">
    <ul>
        <li><button type="button" class="btn-close">关闭</button></li>
        <li><button type="submit" class="btn-green">保存</button></li>
    </ul>
</div>